﻿Public Class ExperimentalForm

    Dim MinLeft As Integer
    Dim MinTop As Integer
    Dim MaxLeft As Integer
    Dim MaxTop As Integer

    Private Sub ExperimentalForm_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
        'Dim vFood As New Food
        'Dim p As Point = Me.PointToClient(Control.MousePosition)

        'With vFood
        '    .Left = p.X - (vFood.Width / 2)
        '    .Top = p.Y - (vFood.Height / 2)
        '    .FoodType = 3
        'End With

        'Me.Controls.Add(vFood)

    End Sub

    Private Sub ExperimentalForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MinLeft = CowField1.Left
        MinTop = CowField1.Top
        MaxLeft = MinLeft + CowField1.Width
        MaxTop = CowField1.Height - MinTop
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim acak As New Random
        Dim sapi As New Cow

        With sapi
            .Left = acak.Next(MinLeft, MaxLeft)
            .Top = acak.Next(MinTop, MaxTop)
            .MinLeft = 12
            .MinTop = 115 + .Height
            .MaxLeft = .MinLeft + CowField1.Width - .Width
            .MaxTop = 115 + CowField1.Height
            .Pause(False)
        End With

        Me.Controls.Add(sapi)

    End Sub

    Private Sub CowField1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CowField1.Click
        Dim vFood As New Food
        Dim p As Point = Me.PointToClient(Control.MousePosition)

        With vFood
            .Left = p.X - (vFood.Width / 2)
            .Top = p.Y - (vFood.Height / 2)
            .FoodType = 2
        End With

        Me.Controls.Add(vFood)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim acak As New Random
        Dim pencuri As New Thief

        With pencuri
            .Left = acak.Next(MinLeft, MaxLeft)
            .Top = acak.Next(MinTop, MaxTop)
            .Pause(False)
        End With

        Me.Controls.Add(pencuri)

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        'StatusPoints1.Pause(False)
        'CowField1.FeedTime(True)
    End Sub

    Private Sub ExperimentalForm_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove

        If (e.X <= CowField1.Left Or e.Y <= CowField1.Top) And CowField1.VisualMouse = True Then
            'CowField1.FeedTime(False)
        End If
    End Sub

End Class